<!DOCTYPE html>
<html>
<head>
<title>订单</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
	<header>
		<h1>填写收货信息</h1>
	</header>
	<main>
		 <p>
            <label>*收货人:<input v-model="e.name" ></label>
        </p>
        <p>
            <label>
            	收货地址:<input v-model="e.address" >
            </label>
        </p>
        <p>
            <label>收货人电话:<input v-model="e.phoneNumber" ></label>
        </p>
        <p>
            <label>*总价(元):<input v-model="e.totalPrice" ></label>
        </p>
       
        <p>
            <button @click="remove">确认支付</button>
            <a href="/order.html">返回</a>	
        </p>
	</main>
	
	<script src="/static/js/jquery.js"></script>
	 <script
		src="/static/js/yi.toast.js"></script> 
		<script src="/static/js/vue.js"></script>
		
		<script>
			const vue=new Vue({
				el:"body>main",
				data:{
					e:{
						//TODO 获取id
						id:1
						
					}
				
				},
				methods:{
					remove:function(){
						$.post("/order/add.do",this.e,function(resp){
							if(resp.code!=="ok"){
								toast(resp.message);
							}else{
								toast("支付成功");
								setTimeout(function(){
									window.location.href="order.html";	
								},500);
								
								
							}
						});
					}
				},
				created:function(){
					//只读所有input
				
					$.getJSON("/Address/selectAll.do",{
						customerId:this.e.id
					},function(resp){
						if(resp.code!=="ok"){
							toast(resp.message);
						}else{
							console.log(resp);
							vue.e=resp.data;
						}
					});
					
				}
			});
		
		</script>
</body>
</html>